<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="6" :xs="24">
        <el-card class="user-info">
          <div slot="header" class="clearfix">
            <span>个人信息</span>
          </div>
          <div>
            <!-- <img src="../../assets/light.png" alt=""> -->
            <ul class="list-group list-group-striped">
              <li class="list-group-item">
                <i class="el-icon-user-solid" />用户名称
                <span class="pull-right">{{ user.userName }}</span>
              </li>
              <li class="list-group-item">
                <i class="el-icon-mobile" />手机号码
                <span class="pull-right">{{ user.phonenumber }}</span>
              </li>
              <li class="list-group-item">
                <i class="el-icon-message" />用户邮箱
                <span class="pull-right">{{ user.email }}</span>
              </li>
              <li class="list-group-item">
                <i class="el-icon-s-custom" />所属角色
                <span class="pull-right">{{ roleGroup }}</span>
              </li>
              <li class="list-group-item">
                <i class="el-icon-date" />创建日期
                <span class="pull-right">{{ user.createTime }}</span>
              </li>
            </ul>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18" :xs="24" class="hidden-xs-only">
        <el-card class='reset-pwd'>
          <div slot="header" class="clearfix">
            <span>基本资料</span>
          </div>
          <el-tabs v-model="activeTab">
            <el-tab-pane label="基本资料" name="userinfo">
              <userInfo :user="user" />
            </el-tab-pane>
            <el-tab-pane label="修改密码" name="resetPwd">
              <resetPwd :user="user" />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import 'element-ui/lib/theme-chalk/display.css';
// import userAvatar from "./userAvatar";
import userInfo from "./userInfo";
import resetPwd from "./resetPwd";

export default {
  name: "Profile",
  // components: { userAvatar, userInfo, resetPwd },
  components: { userInfo, resetPwd },
  data() {
    return {
      user: {
        userName: 'light',
        phonenumber: '18688888888',
        email: '123@163.com',
        createTime: '2021-5-30'
      },
      // roleGroup: {},
      roleGroup: '普通用户',
      activeTab: "userinfo"
    };
  },
  // created() {
  //   this.getUser();
  // },
  // methods: {
  //   getUser() {
  //     getUserProfile().then(response => {
  //       this.user = response.data;
  //       this.roleGroup = response.roleGroup;
  //       this.postGroup = response.postGroup;
  //     });
  //   }
  // }
};
</script>

<style>
  .pull-right{
    float: right;
  }
  .list-group-item{
    height: 40px;
  }
  .user-info{
    height: 450px;
  }
  .reset-pwd{
    height: 450px;
  }
  .clearfix{
    height: 30px;
  }
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }
</style>
